package com.tang.model.state.order;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * Created by Tom.
 */
@Configuration
@ComponentScan("com.tang.model.state.order")
//@SpringBootApplication
public class Test {
    public static void main(String[] args) {
        Thread.currentThread().setName("主线程");
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Test.class);
        IOrderService orderService = (IOrderService) context.getBean("orderService");
        orderService.create();
        orderService.create();
        Order order = orderService.pay(1);
        System.out.println(order.getStatus());
        order =  orderService.deliver(1);
        System.out.println(order.getStatus());
        order = orderService.receive(1);
        System.out.println(order.getStatus());
//        new Thread("客户线程") {
//            @Override
//            public void run() {
//
//            }
//        }.start();
        orderService.pay(2);
        orderService.deliver(2);
        orderService.receive(2);
        System.out.println("全部订单状态：" + orderService.getOrders());

    }
}
